package test;

import java.util.Vector;

import socketVersion.client.MiddleServerWrapper;

public class LoadTester {
	
	public static void main(String[] args){
		final MiddleServerWrapper tester = new MiddleServerWrapper("localhost", 10000);
		Thread a = new Thread(){
			public void run(){
				while(true){
					try {
						Thread.sleep(100);
					} catch (InterruptedException e1) {
						e1.printStackTrace();
					}
					try {
						tester.deleteCars(666,"Montreal");
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}
		};
		
		Thread b = new Thread(){
			public void run(){
				while(true){
					try {
						Thread.sleep(100);
					} catch (InterruptedException e1) {
						e1.printStackTrace();
					}
					try {
						tester.addFlight(1,2,3,4);
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}
		};
		
		Thread c = new Thread(){
			public void run(){
				while(true){
					try {
						Thread.sleep(100);
					} catch (InterruptedException e1) {
						e1.printStackTrace();
					}
					try {
						tester.queryCustomerInfo(4421, 23);
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}
		};
		
		Thread d = new Thread(){
			public void run(){
				while(true){
					try {
						Thread.sleep(100);
					} catch (InterruptedException e1) {
						e1.printStackTrace();
					}
					try {
						tester.itinerary(1, 2, new Vector() , "MONTREAL", false, true);
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}
		};
		
		Thread e = new Thread(){
			public void run(){
				while(true){
					try {
						Thread.sleep(100);
					} catch (InterruptedException e1) {
						e1.printStackTrace();
					}
					try {
						tester.queryCustomerInfo(4421, 23);
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}
		};
		
		Thread f = new Thread(){
			public void run(){
				while(true){
					try {
						Thread.sleep(100);
					} catch (InterruptedException e1) {
						e1.printStackTrace();
					}
					try {
						tester.addFlight(1,2,3,4);
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}
		};
		
		a.start();
		b.start();
		c.start();
		d.start();
		e.start();
		f.start();
	}
	
}
